<?
	require_once("config.php");
	
	
	function includeScripts($arrScripts)
	{
		$includes = "";
		
		for ($i = 0; $i < count($arrScripts); $i++)
		{
			switch ( strtolower($arrScripts[$i]) )
			{
				case SCRIPT_JQUERY:
				
					$includes .= "	<script 
										type='text/javascript' 
										src='".URL_ROOT."/js/jquery-1.7.2.min.js'>
									</script> ";
				break;
				
				case SCRIPT_JQUERY_ALERTS:
				
					$includes .= "	<script 
										type='text/javascript' 
										src='".URL_ROOT."/js/jquery.alerts-1.1/jquery.alerts.js'> 
									</script> ";
				break;
				
				case SCRIPT_JQUERY_VALIDATION:
				
					$includes .= "	<script 
										type='text/javascript'
										src='".URL_ROOT."/js/jquery-validation-engine/js/languages/jquery.validationEngine-pt_BR.js'> 
								   	</script> 
									<script 
										type='text/javascript'
										src='".URL_ROOT."/js/jquery-validation-engine/js/jquery.validationEngine.js'> 
								   </script> ";
				break;
				
				case SCRIPT_JQUERY_UI:
				
					$includes .= "	<script 
										type='text/javascript' 
										src='".URL_ROOT."/js/jquery-ui-1.8.20/js/jquery-ui-1.8.20.custom.min.js'> 
									</script> ";
				break;
				
				case SCRIPT_JQUERY_NOTY:
				
					$includes .= "	<script 
										type='text/javascript' 
										src='".URL_ROOT."/js/jquery-noty-v1.2.1/js/jquery.noty.js'> 
									</script> ";
					
				break;
				
				default:
					
					$includes .= "	<script 
										type='text/javascript' 
										src='".URL_ROOT."/". $arrScripts[$i] ."'> 
									</script> ";
					
				break;
			}
		}

		echo $includes;
		
	}
	
	function includeCss($arrCss)
	{
		$includes = "";
		
		for ($i = 0; $i < count($arrCss); $i++)
		{
			switch ( strtolower($arrCss[$i]) )
			{
				case CSS_JQUERY_ALERTS:
				
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/js/jquery.alerts-1.1/jquery.alerts.css' />";
					
				break;
				
				case CSS_JQUERY_VALIDATION:
					
					$includes .= " <link rel='stylesheet' ";
					$includes .= "	href='".URL_ROOT."/js/jquery-validation-engine/css/validationEngine.jquery.css' />";
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/js/jquery-validation-engine/css/template.css' /> ";
					
				break;
				
				case CSS_JQUERY_UI:
				
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/js/jquery-ui-1.8.20/css/jquery-ui-1.8.20.custom.css' />";
					
				break;
				
				case CSS_JQUERY_NOTY:
				
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/js/jquery-noty-v1.2.1/css/jquery.noty.css' />";
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/js/jquery-noty-v1.2.1/css/noty_theme_default.css' />";
					
				break;
				
				default:
				
					$includes .= " <link rel='stylesheet' href='".URL_ROOT."/". $arrCss[$i] ."' />";
					
				break;
				
			}
		}

		echo $includes;
	}
	
	
	/* Função: request_GET_POST
	 * 
	 * Descrição: verifica se a variável "$varRequest" foi passada
	 *			  via GET ou POST, retornando.
	 * 
	 * Parâmetros: $varRequest  - string correspondente ao nome da 
	 *			   				  variável a ser verificada
	 *			   $requestType - (Opcional) Tipo do retorno esperado
	 *							  para que seja feita a conversão.
	 *
	 * Retorno: Valor da variável, caso tenha sido enviada, ou 
	 *			vazio ("") caso contrário
	 * Autor: Alexandre Varizi Ribeiro
	 * Data:  26/06/2012
	 */
	if (!function_exists("request_GET_POST")) 
	{
			
		function request_GET_POST($varRequest, $requestType="") 
		{
			$request = "";
			
			if ( isset($_POST[$varRequest]) || isset($_GET[$varRequest]) )
			{	
				if ( isset($_POST[$varRequest]) )
				{
					$request = $_POST[$varRequest];
				} else 
				{
					$request = $_GET[$varRequest];
				}
			}
			
			if ( !empty($requestType) )
			{
				switch ( strtolower($requestType) )
				{
					case "int":
						$request = intval($request);
						break;	
					case "double":
						$request = doubleval($request);
						break;	
					case "float":
						$request = floatval($request);
						break;	
				}
			}
			
			
			return $request;
		}
	}

?>